/**
 * Buffer数据结构的相关处理
 */

 /**合并buffer拼接转发 */
 function mergeArrayBuffer(ab1,ab2){
     var u81=new Uint8Array(ab1),
         u82=new Uint8Array(ab2),
         res=new Uint8Array(ab1.byteLength + ab2.byteLength)
     res.set(u81,0)
     res.set(u82,ab1.byteLength)
     return res.buffer     
 }

 function char2ab(str) {
    var buf = new ArrayBuffer(str.length);
    var bufView = new Uint8Array(buf);
    for (var i=0; i<str.length; i++) {
        bufView[i] = str[i];
    }
    return buf;
}


module.exports={
    mergeArrayBuffer,
    char2ab,
}